package edu.gatech.teamrocket.models;

import java.util.Date;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.misc.BaseDaoEnabled;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable (tableName = "tasks")
public class Task extends BaseDaoEnabled<Task, Integer> {
	@DatabaseField(columnName = "_id", generatedId = true)
	private int id;
	
	@DatabaseField (canBeNull = false, foreign = true)
	private User user;
	
	@DatabaseField (foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true)
	private Category category;
	
	@DatabaseField (canBeNull = false)
	private String name;
	
	@DatabaseField
	private String details;
	
	@DatabaseField (canBeNull = true)
	private Date time;
	
	@DatabaseField
	private boolean recurring;
	
	@DatabaseField
	private String location;
	
	@DatabaseField
	private boolean completed;
	
	public Task() { }
	
	public Task(String name, String details, User user, Category category, Date time, boolean recurring) {
		this.name = name;
		this.details = details;
		this.user = user;
		this.category = category;
		this.time = time;
		this.recurring = recurring;
		this.completed = false;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public Integer getId() {
		return id;
	}
	
	public User getUser() {
		return user;
	}
	
	public void setUser(User user) {
		this.user = user;
	}
	
	public Category getCategory() {
		return category;
	}
	
	public void setCategory(Category category) {
		this.category = category;
	}
	
	public String getLocation() {
		return location;
	}
	
	public void setLocation(String location) {
		this.location = location;
	}
	
	public Date getTime() {
		return time;
	}
	
	public void setTime(Date time) {
		this.time = time;
	}
	
	public boolean getRecurring() {
		return recurring;
	}
	
	public void setRecurring(boolean recurring) {
		this.recurring = recurring;
	}
	
	public String getDetails() {
		return details;
	}
	
	public void setDetails(String details) {
		this.details = details;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}	
	
	public boolean isCompleted() {
		return completed;
	}
	
	public void setCompleted(boolean completed) {
		this.completed = completed;
	}
	
	public String toString() {
		return this.name;
	}
}
